package o;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import huawei.widget.HwProgressBar;
import huawei.widget.HwTextView;
import o.ddq.c;
import o.ddq.d;

public class deb extends AlertDialog {
    private Context ˊ;
    private HwProgressBar ˋ;
    private HwTextView ˎ;
    private HwTextView ˏ;
    private ImageView ॱ;

    public deb(Context context) {
        super(context);
        this.ˊ = context;
        ayw.ˊ(getWindow());
        setView(ॱ(getContext()));
    }

    private View ॱ(Context context) {
        View inflate = LayoutInflater.from(context).inflate(c.ʻॱ, null);
        azb.ˏ(inflate);
        this.ˋ = (HwProgressBar) inflate.findViewById(d.ʾ);
        this.ˎ = (HwTextView) inflate.findViewById(d.ˊˊ);
        this.ˏ = (HwTextView) inflate.findViewById(d.ʼॱ);
        this.ॱ = (ImageView) inflate.findViewById(d.ʻ);
        return inflate;
    }

    public void ˋ(String str) {
        this.ˎ.setText(str);
    }

    public void ॱ(float f) {
        int i = (int) (100.0f * f);
        this.ˋ.setProgress(i);
        this.ˏ.setText(MinimumFactory.setMinimumFt(i));
    }

    public void dismiss() {
        if (this.ˊ != null && !((Activity) this.ˊ).isFinishing()) {
            super.dismiss();
        }
    }

    public void show() {
        if (this.ˊ == null || ((Activity) this.ˊ).isFinishing()) {
            Object obj;
            ddu o_ddu = ddu.ˊ;
            String str = "ProgressDialog";
            StringBuilder append = new StringBuilder().append("show dlg error, context = ").append(this.ˊ).append(", mContext.isFinishing is ");
            if (this.ˊ == null) {
                obj = "context == null";
            } else {
                obj = Boolean.valueOf(((Activity) this.ˊ).isFinishing());
            }
            o_ddu.ˊ(str, append.append(obj).toString());
            return;
        }
        try {
            super.show();
            ayw.ˊ(getWindow());
        } catch (Throwable e) {
            ddu.ˊ.ˊ("ProgressDialog", "show dlg error, e: ", e);
        }
        if (this.ˋ != null) {
            this.ˋ.setVisibility(0);
        }
        this.ॱ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ deb ˋ;

            {
                this.ˋ = r1;
            }

            public void onClick(View view) {
                this.ˋ.dismiss();
            }
        });
    }
}
